<?php
class LoginHandler {
	private $SessionLoginCheck = '';
	public function isLoggedIn() {
		//Returns true if user is Logged in
		if(isset($_SESSION[$this -> SessionLoginCheck])) {
			return true;
		} else {
			return false;
		}
	}
	public function doLogin($name, $password) {
		//If fields are not empty, check input against "registered" users
		if($name && $password != null) {
			switch($name){
				//User Lisa
				case "Lisa";
				if($password == "123456"){
					//If password is correct, set session variable to loggedIn and return true 
					$_SESSION[$this -> SessionLoginCheck] = "loggedIn";
					return true;
				}
				else return false;
				//User Anna
				case "Anna";
				if($password == "000000"){
					//If password is correct, set session variable to loggedIn and return true 
					$_SESSION[$this -> SessionLoginCheck] = "loggedIn";
					return true;
				}
				else return false;
				//User Karin
				case "Karin";
				if($password == "555555"){
					//If password is correct, set session variable to loggedIn and return true 
					$_SESSION[$this -> SessionLoginCheck] = "loggedIn";
					return true;
				}
				else return false;
			}
		} else {return false;}
	}
	public function doLogout() {
		// unset
		unset($_SESSION[$this -> SessionLoginCheck]);
	}
}
?>